// Ariel White, Jennifer Hochschild, Claudine Gay
// July 2015
// Replication code for main LFSS 2009 (TESS survey) analyses discussed in paper
// This script was tested in Stata SE 13

//note that we begin here with a recoded version of the original Knowledge Neworks-provided dataset.  
//the replication file also includes the raw data ("tess2_011_hochschild_final_data.dta" and "tess2_011_hochschild_final_data_081110.dta") and the recoding file ("Recode Raw Data.do")

clear
set more off
cd "C:\Users\arwhite\Desktop\replicationdata\tessdata" // change filepath accordingly
use "tess2_011_hochschild_r30Mar11.dta" //change filepath

//sample sizes
table ppethm
table ppethm if groupC==0


///////////////////////////////////////////////////////////////////////////////////////
// Estimates for Fig. 2 (figure itself is produced in R code.)
gen lower_working=1 if lower==1|working==1
replace lower_working=0 if middle==1|upper==1
//make a different nonchristian variable to avoid categorizing nonreligious as christians by default
gen old_nonchristian = nonchristian
replace nonchristian = 1 if noreligion==1
gen nonwhite = .
replace nonwhite = 0 if white == 1
replace nonwhite = 1 if white==0

gen noweight = 1
svyset _n [pweight = noweight] //unweighted, though svy weights don't make a huge difference here.

preserve
keep if black

//lf_class:
svy, over(lower_working): mean lf_class
lincom [lf_class]0 - [lf_class]1 
scalar black_class =  r(estimate)
scalar black_class_se = r(se)

//gender
svy, over(female): mean lf_gender
lincom [lf_gender]0 - [lf_gender]1 
scalar black_gender =  r(estimate)
scalar black_gender_se = r(se)

//religion
svy, over(nonchristian): mean lf_religion
lincom [lf_religion]0 - [lf_religion]1 
scalar black_religion =  r(estimate)
scalar black_religion_se = r(se)

restore

preserve
keep if white

//lf_class:
svy, over(lower_working): mean lf_class
//test [lf_race]0 = [lf_race]1 
lincom [lf_class]0 - [lf_class]1 
scalar white_class =  r(estimate)
scalar white_class_se = r(se)

//gender
svy, over(female): mean lf_gender
lincom [lf_gender]0 - [lf_gender]1 
scalar white_gender =  r(estimate)
scalar white_gender_se = r(se)


//religion
svy, over(nonchristian): mean lf_religion
lincom [lf_religion]0 - [lf_religion]1 
scalar white_religion =  r(estimate)
scalar white_religion_se = r(se)

restore

preserve
keep if hispanic

//lf_class:
svy, over(lower_working): mean lf_class
//test [lf_race]0 = [lf_race]1 
lincom [lf_class]0 - [lf_class]1 
scalar hispanic_class =  r(estimate)
scalar hispanic_class_se = r(se)

//gender
svy, over(female): mean lf_gender
lincom [lf_gender]0 - [lf_gender]1 
scalar hispanic_gender =  r(estimate)
scalar hispanic_gender_se = r(se)


//religion
svy, over(nonchristian): mean lf_religion
lincom [lf_religion]0 - [lf_religion]1 
scalar hispanic_religion =  r(estimate)
scalar hispanic_religion_se = r(se)

restore

preserve
keep if asian

//lf_class:
svy, over(lower_working): mean lf_class
//test [lf_race]0 = [lf_race]1 
lincom [lf_class]0 - [lf_class]1 
scalar asian_class =  r(estimate)
scalar asian_class_se = r(se)

//gender
svy, over(female): mean lf_gender
lincom [lf_gender]0 - [lf_gender]1 
scalar asian_gender =  r(estimate)
scalar asian_gender_se = r(se)


//religion
svy, over(nonchristian): mean lf_religion
lincom [lf_religion]0 - [lf_religion]1 
scalar asian_religion =  r(estimate)
scalar asian_religion_se = r(se)

restore

//oh, do this for everyone as well.
preserve

//lf_class:
svy, over(lower_working): mean lf_class
//test [lf_race]0 = [lf_race]1 
lincom [lf_class]0 - [lf_class]1 
scalar all_class =  r(estimate)
scalar all_class_se = r(se)

//gender
svy, over(female): mean lf_gender
lincom [lf_gender]0 - [lf_gender]1 
scalar all_gender =  r(estimate)
scalar all_gender_se = r(se)


//religion
svy, over(nonchristian): mean lf_religion
lincom [lf_religion]0 - [lf_religion]1 
scalar all_religion =  r(estimate)
scalar all_religion_se = r(se)

//race(just for this approach)
svy, over(nonwhite): mean lf_race
lincom [lf_race]0 - [lf_race]1 
scalar all_race =  r(estimate)
scalar all_race_se = r(se)

restore


//also want to do race (a slightly different comparison):
xi: svy: regress lf_race i.ppethm
testparm _I*

svy, over(ppethm): mean lf_race
lincom [lf_race]_subpop_1 - [lf_race]_subpop_2
scalar white_black = r(estimate)
scalar white_black_se = r(se)

lincom [lf_race]_subpop_1 - [lf_race]_subpop_3
scalar white_asian = r(estimate)
scalar white_asian_se = r(se)

lincom [lf_race]_subpop_1 - [lf_race]hispanic
scalar white_hispanic = r(estimate)
scalar white_hispanic_se = r(se)

matrix sociologicaldifferences = (white_class, white_class_se \ white_gender, white_gender_se \ white_religion, white_religion_se \ 0, 0 \ black_class, black_class_se \ black_gender, black_gender_se \ black_religion, black_religion_se\ white_black, white_black_se \hispanic_class, hispanic_class_se \ hispanic_gender, hispanic_gender_se \ hispanic_religion, hispanic_religion_se \ white_hispanic, white_hispanic_se \asian_class, asian_class_se \ asian_gender, asian_gender_se \ asian_religion, asian_religion_se \ white_asian, white_asian_se \ all_class, all_class_se \ all_gender, all_gender_se \ all_religion, all_religion_se \ all_race, all_race_se)
matrix rownames sociologicaldifferences= white_class white_gender white_religion white_race black_class black_gender black_religion black_race hispanic_class hispanic_gender hispanic_religion hispanic_race asian_class asian_gender asian_religion asian_race all_class all_gender all_religion all_race
matrix colnames sociologicaldifferences= diff_est SE
matrix list sociologicaldifferences

mat2txt, matrix(sociologicaldifferences) saving(sociologicaldifferences_unweighted_feb2014.csv) replace
//this produces a lot more comparisons than we ultimately plot


///////////////////////////////////////////////////////////////////////////////////////
// Estimates for Fig. 3 (figure itself is produced in R code.)

clear
set more off
use "tess2_011_hochschild_r30Mar11.dta"
svyset _n [pweight = weight2a]

drop if groupC==1
gen voterreg = 1 if (pppa0003==1|pppa0003==2)
replace voterreg=0 if pppa0003 == 3 

//rescale the party var
gen party = 8-xparty7
tab party

//white respondents

svy, subpop(white): reg voterreg lf_race 
postfile coeffs racegrp lf outcome  coeff serr using politicizationcoeffs_new, replace
post coeffs (0) (1) (1) (_b[lf_race]) (_se[lf_race])
//0 = white, 1=lf_race, 1=voterreg

svy, subpop(white): reg pppa0083 lf_race 
post coeffs (0) (1) (2) (_b[lf_race]) (_se[lf_race])

svy, subpop(white): reg pppa0098 lf_race 
post coeffs (0) (1) (3) (_b[lf_race]) (_se[lf_race])

svy, subpop(white): reg pppa0099 lf_race 
post coeffs (0) (1) (4) (_b[lf_race]) (_se[lf_race])

svy, subpop(white): reg party lf_race 
post coeffs (0) (1) (5) (_b[lf_race]) (_se[lf_race])

svy, subpop(white): reg xideo lf_race 
post coeffs (0) (1) (6) (_b[lf_race]) (_se[lf_race])

//next, see if there appears to be any effect for other LF's:
//class:
svy, subpop(white): reg voterreg lf_class
post coeffs (0) (2) (1) (_b[lf_class]) (_se[lf_class])

svy, subpop(white): reg pppa0083 lf_class 
post coeffs (0) (2) (2) (_b[lf_class]) (_se[lf_class])

svy, subpop(white): reg pppa0098 lf_class
post coeffs (0) (2) (3) (_b[lf_class]) (_se[lf_class])

svy, subpop(white): reg pppa0099 lf_class
post coeffs (0) (2) (4) (_b[lf_class]) (_se[lf_class])

svy, subpop(white): reg party lf_class
post coeffs (0) (2) (5) (_b[lf_class]) (_se[lf_class])

svy, subpop(white): reg xideo lf_class
post coeffs (0) (2) (6) (_b[lf_class]) (_se[lf_class])

//gender?
svy, subpop(white): reg voterreg lf_gender
post coeffs (0) (3) (1) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(white): reg pppa0083 lf_gender 
post coeffs (0) (3) (2) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(white): reg pppa0098 lf_gender
post coeffs (0) (3) (3) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(white): reg pppa0099 lf_gender
post coeffs (0) (3) (4) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(white): reg party lf_gender
post coeffs (0) (3) (5) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(white): reg xideo lf_gender
post coeffs (0) (3) (6) (_b[lf_gender]) (_se[lf_gender])

//finally, religion
svy, subpop(if white==1): reg voterreg lf_religion
post coeffs (0) (4) (1) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if white==1): reg pppa0083 lf_religion 
post coeffs (0) (4) (2) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if white==1): reg pppa0098 lf_religion
post coeffs (0) (4) (3) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if white==1): reg pppa0099 lf_religion
post coeffs (0) (4) (4) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if white==1): reg party lf_religion
post coeffs (0) (4) (5) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if white==1): reg xideo lf_religion
post coeffs (0) (4) (6) (_b[lf_religion]) (_se[lf_religion])


///black respondents:

svy, subpop(black): reg voterreg lf_race 
post coeffs (1) (1) (1) (_b[lf_race]) (_se[lf_race])
//1= black, 1=lf_race, 1=voterreg

svy, subpop(black): reg pppa0083 lf_race 
post coeffs (1) (1) (2) (_b[lf_race]) (_se[lf_race])

svy, subpop(black): reg pppa0098 lf_race 
post coeffs (1) (1) (3) (_b[lf_race]) (_se[lf_race])

svy, subpop(black): reg pppa0099 lf_race 
post coeffs (1) (1) (4) (_b[lf_race]) (_se[lf_race])

svy, subpop(black): reg party lf_race 
post coeffs (1) (1) (5) (_b[lf_race]) (_se[lf_race])

svy, subpop(black): reg xideo lf_race 
post coeffs (1) (1) (6) (_b[lf_race]) (_se[lf_race])

//next, see if there appears to be any effect for other LF's:
//class:
svy, subpop(black): reg voterreg lf_class
post coeffs (1) (2) (1) (_b[lf_class]) (_se[lf_class])

svy, subpop(black): reg pppa0083 lf_class 
post coeffs (1) (2) (2) (_b[lf_class]) (_se[lf_class])

svy, subpop(black): reg pppa0098 lf_class
post coeffs (1) (2) (3) (_b[lf_class]) (_se[lf_class])

svy, subpop(black): reg pppa0099 lf_class
post coeffs (1) (2) (4) (_b[lf_class]) (_se[lf_class])

svy, subpop(black): reg party lf_class
post coeffs (1) (2) (5) (_b[lf_class]) (_se[lf_class])

svy, subpop(black): reg xideo lf_class
post coeffs (1) (2) (6) (_b[lf_class]) (_se[lf_class])

//gender?
svy, subpop(black): reg voterreg lf_gender
post coeffs (1) (3) (1) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(black): reg pppa0083 lf_gender 
post coeffs (1) (3) (2) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(black): reg pppa0098 lf_gender
post coeffs (1) (3) (3) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(black): reg pppa0099 lf_gender
post coeffs (1) (3) (4) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(black): reg party lf_gender
post coeffs (1) (3) (5) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(black): reg xideo lf_gender
post coeffs (1) (3) (6) (_b[lf_gender]) (_se[lf_gender])

//finally, religion
svy, subpop(if black==1): reg voterreg lf_religion
post coeffs (1) (4) (1) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if black==1): reg pppa0083 lf_religion 
post coeffs (1) (4) (2) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if black==1): reg pppa0098 lf_religion
post coeffs (1) (4) (3) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if black==1): reg pppa0099 lf_religion
post coeffs (1) (4) (4) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if black==1): reg party lf_religion
post coeffs (1) (4) (5) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if black==1): reg xideo lf_religion
post coeffs (1) (4) (6) (_b[lf_religion]) (_se[lf_religion])


//hispanic respondents:
svy, subpop(hispanic): reg voterreg lf_race 
post coeffs (3) (1) (1) (_b[lf_race]) (_se[lf_race])
//3 = hispanic, 1=lf_race, 1=voterreg

svy, subpop(hispanic): reg pppa0083 lf_race 
post coeffs (3) (1) (2) (_b[lf_race]) (_se[lf_race])

svy, subpop(hispanic): reg pppa0098 lf_race 
post coeffs (3) (1) (3) (_b[lf_race]) (_se[lf_race])

svy, subpop(hispanic): reg pppa0099 lf_race 
post coeffs (3) (1) (4) (_b[lf_race]) (_se[lf_race])

svy, subpop(hispanic): reg party lf_race 
post coeffs (3) (1) (5) (_b[lf_race]) (_se[lf_race])


svy, subpop(hispanic): reg xideo lf_race 
post coeffs (3) (1) (6) (_b[lf_race]) (_se[lf_race])

//next, see if there appears to be any effect for other LF's:
//class:
svy, subpop(hispanic): reg voterreg lf_class
post coeffs (3) (2) (1) (_b[lf_class]) (_se[lf_class])

svy, subpop(hispanic): reg pppa0083 lf_class 
post coeffs (3) (2) (2) (_b[lf_class]) (_se[lf_class])

svy, subpop(hispanic): reg pppa0098 lf_class
post coeffs (3) (2) (3) (_b[lf_class]) (_se[lf_class])

svy, subpop(hispanic): reg pppa0099 lf_class
post coeffs (3) (2) (4) (_b[lf_class]) (_se[lf_class])

svy, subpop(hispanic): reg party lf_class
post coeffs (3) (2) (5) (_b[lf_class]) (_se[lf_class])

svy, subpop(hispanic): reg xideo lf_class
post coeffs (3) (2) (6) (_b[lf_class]) (_se[lf_class])

//gender?
svy, subpop(hispanic): reg voterreg lf_gender
post coeffs (3) (3) (1) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(hispanic): reg pppa0083 lf_gender 
post coeffs (3) (3) (2) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(hispanic): reg pppa0098 lf_gender
post coeffs (3) (3) (3) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(hispanic): reg pppa0099 lf_gender
post coeffs (3) (3) (4) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(hispanic): reg party lf_gender
post coeffs (3) (3) (5) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(hispanic): reg xideo lf_gender
post coeffs (3) (3) (6) (_b[lf_gender]) (_se[lf_gender])

//finally, religion
svy, subpop(if hispanic==1): reg voterreg lf_religion
post coeffs (3) (4) (1) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if hispanic==1): reg pppa0083 lf_religion 
post coeffs (3) (4) (2) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if hispanic==1): reg pppa0098 lf_religion
post coeffs (3) (4) (3) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if hispanic==1): reg pppa0099 lf_religion
post coeffs (3) (4) (4) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if hispanic==1): reg party lf_religion
post coeffs (3) (4) (5) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if hispanic==1): reg xideo lf_religion
post coeffs (3) (4) (6) (_b[lf_religion]) (_se[lf_religion])


//asian respondents:
svy, subpop(asian): reg voterreg lf_race 
post coeffs (2) (1) (1) (_b[lf_race]) (_se[lf_race])
//2 = asian, 1=lf_race, 1=voterreg

svy, subpop(asian): reg pppa0083 lf_race 
post coeffs (2) (1) (2) (_b[lf_race]) (_se[lf_race])

svy, subpop(asian): reg pppa0098 lf_race 
post coeffs (2) (1) (3) (_b[lf_race]) (_se[lf_race])

svy, subpop(asian): reg pppa0099 lf_race 
post coeffs (2) (1) (4) (_b[lf_race]) (_se[lf_race])

svy, subpop(asian): reg party lf_race 
post coeffs (2) (1) (5) (_b[lf_race]) (_se[lf_race])

svy, subpop(asian): reg xideo lf_race 
post coeffs (2) (1) (6) (_b[lf_race]) (_se[lf_race])

//next, see if there appears to be any effect for other LF's:
//class:
svy, subpop(asian): reg voterreg lf_class
post coeffs (2) (2) (1) (_b[lf_class]) (_se[lf_class])

svy, subpop(asian): reg pppa0083 lf_class 
post coeffs (2) (2) (2) (_b[lf_class]) (_se[lf_class])

svy, subpop(asian): reg pppa0098 lf_class
post coeffs (2) (2) (3) (_b[lf_class]) (_se[lf_class])

svy, subpop(asian): reg pppa0099 lf_class
post coeffs (2) (2) (4) (_b[lf_class]) (_se[lf_class])

svy, subpop(asian): reg party lf_class
post coeffs (2) (2) (5) (_b[lf_class]) (_se[lf_class])

svy, subpop(asian): reg xideo lf_class
post coeffs (2) (2) (6) (_b[lf_class]) (_se[lf_class])

//gender?
svy, subpop(asian): reg voterreg lf_gender
post coeffs (2) (3) (1) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(asian): reg pppa0083 lf_gender 
post coeffs (2) (3) (2) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(asian): reg pppa0098 lf_gender
post coeffs (2) (3) (3) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(asian): reg pppa0099 lf_gender
post coeffs (2) (3) (4) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(asian): reg party lf_gender
post coeffs (2) (3) (5) (_b[lf_gender]) (_se[lf_gender])

svy, subpop(asian): reg xideo lf_gender
post coeffs (2) (3) (6) (_b[lf_gender]) (_se[lf_gender])

//finally, religion
svy, subpop(if asian==1): reg voterreg lf_religion
post coeffs (2) (4) (1) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if asian==1):  reg pppa0083 lf_religion 
post coeffs (2) (4) (2) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if asian==1):  reg pppa0098 lf_religion
post coeffs (2) (4) (3) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if asian==1):  reg pppa0099 lf_religion
post coeffs (2) (4) (4) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if asian==1):  reg party lf_religion
post coeffs (2) (4) (5) (_b[lf_religion]) (_se[lf_religion])

svy, subpop(if asian==1):  reg xideo lf_religion
post coeffs (2) (4) (6) (_b[lf_religion]) (_se[lf_religion])
postclose coeffs


//now read that post file into Stata again, and export it in a useful format.
clear
use "politicizationcoeffs_new"
outsheet using "politicizationcoeffs_new.csv", comma nolabel replace

///////////////////////////////////////////////////////////////////////////////////////
//  Some estimates discussed in-text
clear
set more off
use "tess2_011_hochschild_r30Mar11.dta"
svyset _n [pweight = weight2a]
gen lower_working=1 if lower==1|working==1
replace lower_working=0 if middle==1|upper==1


/// and finally pull quantities for in-text.

gen lf_race_yes = .
replace lf_race_yes = 0 if lf_race == 0
replace lf_race_yes = 1 if lf_race >0

gen lf_race_very = .
replace lf_race_very = 0 if lf_race <3
replace lf_race_very = 1 if lf_race == 3

svy, over(ppethm): mean lf_race_yes
svy, over(ppethm): mean lf_race_very


preserve 
keep if lf_class != .
tab lf_class
gen lf_class_some = 0
replace lf_class_some =1 if lf_class >1
tab lf_class_some
svy: mean lf_class_some

gen lf_class_alot = 0
replace lf_class_alot = 1 if lf_class == 3
svy, over(ppethm): mean lf_class_alot
svy, over(ppethm): mean lf_class_some

restore
 
//Black religious LF, compared to whites
svy, over(ppethm): mean lf_religion
lincom [lf_religion]_subpop_1 - [lf_religion]_subpop_2


///////////////////////////////////////////////////////////////////////////////////////
// Robustness to experimental manipulation (LF same across treatment groups)

// Group B (question order), as discussed in paper.
clear
use "tess2_011_hochschild_r30Mar11.dta"

svyset _n [pweight = weight1a]
drop if groupC==1

svy, over(groupB): mean lf_race
lincom [lf_race]1 - [lf_race]0

preserve
keep if black
reg lf_race groupB
svy:reg lf_race groupB //maybe?
svy:ologit lf_race groupB
svy:ologit lf_race txt_Gender txt_Religion txt_Class
restore


//What about Group C: is there a priming effect? (no)
clear
use "tess2_011_hochschild_r30Mar11.dta"
svyset _n [pweight = weight1b]

svy: regress lf_race groupB groupC white black hispanic
svy, subpop(black): reg lf_race groupB groupC
svy, subpop(white): reg lf_race groupB groupC
svy, subpop(asian): reg lf_race groupB groupC
svy, subpop(hispanic): reg lf_race groupB groupC
xi: svy: regress lf_race groupB groupC white black hispanic i.white*i.groupC i.black*i.groupC i.hispanic*i.groupC
// doesn't look like much for Group C (though would want to think about power before completely dismissing).


///////////////////////////////////////////////////////////////////////////////////////
// Inter-item correlations (Table 1)


clear
set more off
use "tess2_011_hochschild_r30Mar11.dta"

// no weights here.
gen noweight=1
svyset _n [pweight = noweight]

corr_svy lf_race lf_class [pweight=weight2a], subpop(white) pw obs sig star(5) 
scalar whiteclass = r(rho)
scalar whiteclassobs = r(N)
corr_svy lf_race lf_class [pweight=weight2a], subpop(black) pw obs sig star(5) 
scalar blackclass = r(rho)
scalar blackclassobs = r(N)
corr_svy lf_race lf_class [pweight=weight2a], subpop(asian) pw obs sig star(5) 
scalar asianclass = r(rho)
scalar asianclassobs = r(N)
corr_svy lf_race lf_class [pweight=weight2a], subpop(hispanic) pw obs sig star(5) 
scalar hispanicclass = r(rho)
scalar hispanicclassobs = r(N)
corr_svy lf_race lf_class [pweight=weight2a], pw obs sig star(5) 
scalar allclass = r(rho)
scalar allclassobs = r(N)

corr_svy lf_race lf_gender [pweight=weight2a], subpop(white) pw obs sig star(5) 
scalar whitegender = r(rho)
scalar whitegenderobs = r(N)
corr_svy lf_race lf_gender [pweight=weight2a], subpop(black) pw obs sig star(5) 
scalar blackgender = r(rho)
scalar blackgenderobs = r(N)
corr_svy lf_race lf_gender [pweight=weight2a], subpop(asian) pw obs sig star(5) 
scalar asiangender = r(rho)
scalar asiangenderobs = r(N)
corr_svy lf_race lf_gender [pweight=weight2a], subpop(hispanic) pw obs sig star(5) 
scalar hispanicgender = r(rho)
scalar hispanicgenderobs = r(N)
corr_svy lf_race lf_gender [pweight=weight2a], pw obs sig star(5) 
scalar allgender = r(rho)
scalar allgenderobs = r(N)

corr_svy lf_race lf_religion [pweight=weight2a], subpop(white) pw obs sig star(5) 
scalar whitereligion = r(rho)
scalar whitereligionobs = r(N)
corr_svy lf_race lf_religion  [pweight=weight2a], subpop(black) pw obs sig star(5) 
scalar blackreligion = r(rho)
scalar blackreligionobs = r(N)
corr_svy lf_race lf_religion  [pweight=weight2a], subpop(asian) pw obs sig star(5) 
scalar asianreligion = r(rho)
scalar asianreligionobs = r(N)
corr_svy lf_race lf_religion  [pweight=weight2a], subpop(hispanic) pw obs sig star(5) 
scalar hispanicreligion = r(rho)
scalar hispanicreligionobs = r(N)
corr_svy lf_race lf_religion  [pweight=weight2a], pw obs sig star(5) 
scalar allreligion = r(rho)
scalar allreligionobs = r(N)


matrix correlations = (whiteclass, blackclass, asianclass, hispanicclass, allclass\whitegender, blackgender, asiangender, hispanicgender, allgender\ whitereligion, blackreligion, asianreligion, hispanicreligion, allreligion)
matrix colnames correlations= White Black Asian Hispanic All
matrix rownames correlations= Race_Class Race_Gender Race_Religion
matrix list correlations
mat2txt, matrix(correlations) saving(pairwiseLFcorrelations_11july12.csv) replace


